package com.team06.login.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.team06.login.entity.Role;
import com.team06.login.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UserMapper extends BaseMapper<User> {
    @Select("SELECT r.* FROM \"airport6\".ROLES r  JOIN \"airport6\".USER_ROLES ur ON r.ID = ur.ROLE_ID WHERE ur.USER_ID = #{userId}")
    List<Role> selectRolesByUserId(@Param("userId") Long userId);
}